<template>
	<view>
		收获地址列表
		
		<button type="default" open-type="getUserInfo" @tap="getAddAuthor">一键获取微信地址</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		methods:{
			getUserAddress(){
				uni.showLoading({title: '加载中',mask: true});
				this.config.post('/api/address/findPage', {
					pageNum: 1,
				}).then(res=>{
					uni.hideLoading();
					if(res.data.code==='0'){
						uni.showToast({title: res.data.message})
						setTimeout(s=>{
							uni.switchTab({
								url:'/pages/home/home'
							})
						}, 500)
					}else{
						uni.showToast({title: self.config.handleError(res.data),icon: 'none'});
					}
				})
			},
			getAddAuthor(){
				let self = this;
				uni.authorize({
				    scope: 'scope.address',
				    success(res) {
						self.getWxAddress()
				    }
				})
			},
			getWxAddress(){
				uni.chooseAddress({
					success(res) {
					    console.log(res.userName)
					    console.log(res.postalCode)
					    console.log(res.provinceName)
					    console.log(res.cityName)
					    console.log(res.countyName)
					    console.log(res.detailInfo)
					    console.log(res.nationalCode)
					    console.log(res.telNumber)
						console.log(res)
					}
				})
			}
		}
	}
</script>

<style lang="less">

</style>
